package com.orangelife.mobile.guide.fragment;

import com.curry.orangelife.mobile.R;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

@SuppressLint("ValidFragment")
public class GuideFragment3 extends Fragment {

	private View homePageView;
	private ImageView ivGuide;
	private int w = 0;

	public GuideFragment3(int w) {
		this.w = w;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		if (homePageView == null) {
			homePageView = inflater.inflate(R.layout.fragment_gui_3, container,
					false);
			initView();
		}
		/*
		 * 缓存的viewiew需要判断是否已经被加过parent，
		 * 如果有parent需要从parent删除，要不然会发生这个view已经有parent的错误。
		 */
		ViewGroup parent = (ViewGroup) homePageView.getParent();
		if (parent != null) {
			parent.removeView(homePageView);
		}

		return homePageView;

	}

	private void initView() {
//		ivGuide = (ImageView) homePageView.findViewById(R.id.iv_guide);

//		float imgW = 1f;
//		float imgH = 1.2f;
//		float width = w / 1.3f;
//		LinearLayout.LayoutParams mParams = new LinearLayout.LayoutParams(
//				(int) (width * imgW), (int) (width * imgH));
//
//		ivGuide.setLayoutParams(mParams);

	}
}
